package server;



import java.util.Date;
import java.util.LinkedList;
import java.util.Vector;
import java.util.concurrent.LinkedBlockingQueue;



public class LogedOnUser {
	
	private LinkedBlockingQueue<NotificationMsg> msg;
	private LinkedList<String> interestedInMe;
	private int curr_topic;
	private int curr_forum;
	private Date loggedInTime;
	
	public LogedOnUser(Date loggTime){
		setMsg(new LinkedBlockingQueue<NotificationMsg>());
		setCurr_topic(-1);
		setCurr_forum(-1);
		setInterestedInMe(new LinkedList<String>());
		setLoggedTime(loggTime);
	}
	
	public void addIntrested(String userName)
	{
		this.interestedInMe.add(userName);
	}
	
	public void removeFromIntrested(String userName)
	{
		this.interestedInMe.remove(userName);	
	}

	public void setLoggedTime (Date lTime)
	{
		this.loggedInTime = lTime;
	}
	
	public Date getLoggedTime ()
	{
		return this.loggedInTime;
	}
	
	public void setMsg(LinkedBlockingQueue<NotificationMsg> arrayList) {
		this.msg = arrayList;
	}

	public LinkedBlockingQueue<NotificationMsg> getMsg() {
		return msg;
	}

	public void setInterestedInMe(LinkedList<String> interestedInMe) {
		this.interestedInMe = interestedInMe;
	}

	public LinkedList<String> getInterestedInMe() {
		return interestedInMe;
	}

	public void setCurr_topic(int curr_topic) {
		this.curr_topic = curr_topic;
	}

	public int getCurr_topic() {
		return curr_topic;
	}
	
	public void setCurr_forum(int curr_forum) {
		this.curr_forum = curr_forum;
	}

	public int getCurr_forum() {
		return curr_forum;
	}
	
	
	public void addToInterested(String user){
		if (!interestedInMe.contains(user))
			interestedInMe.add(user);
	}
	
	public void addMsg(NotificationMsg msg)
	{
		try {
			this.msg.put(msg);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
